// JavaScript Document
function previsualisation(prev,pagename)
{	
t=code_to_html(document.formulaire.bbcode_courant.value,pagename)
document.getElementById("previsualisation").innerHTML = t

}

function code_to_html(t,p)
{
    var xhr=null;
    var data = "code="+t+"&pagename="+p;
    if (window.XMLHttpRequest) { 
        xhr = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) 
    {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
    }
    //on appelle le fichier reponse.txt
    xhr.open("POST", "../javasscripts/preview.php", false);
	xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");         
    xhr.send(data);
    
   t = xhr.responseText;
   
return t
}
